#include "setrowcoldialog.h"
#include "ui_setrowcoldialog.h"

SetRowColDialog::SetRowColDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SetRowColDialog)
{
    this->setWindowTitle("设置行列数");
    ui->setupUi(this);

    row = 10;
    col = 10;
}

SetRowColDialog::~SetRowColDialog()
{
    delete ui;
}

int SetRowColDialog::getRow()
{
    return row;
}

int SetRowColDialog::getCol()
{
    return col;
}

void SetRowColDialog::on_btnOk_clicked()
{
    if (!QMessageBox::question(this, "修改行列", "修改行列后会清除已进行的迷宫设置，是否继续"))
        return;

    row = ui->spinBoxRow->value();
    col = ui->spinBoxCol->value();
    emit this->signalRowColChanged(row, col);
    this->close();
}

void SetRowColDialog::on_btnCancel_clicked()
{
    ui->spinBoxRow->setValue(row);
    ui->spinBoxCol->setValue(col);
    this->close();
}
